package it.antonio.ilpizze.te.token;

import it.antonio.ilpizze.te.Filter;
import it.antonio.ilpizze.te.RenderCommand;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public abstract class NodeRenderCommand implements RenderCommand {

	private NodeRenderCommand parent;
	private List<RenderCommand> children = new LinkedList<RenderCommand>();

	
	
	public NodeRenderCommand(NodeRenderCommand parent) {
		this.parent = parent;
	}

	public NodeRenderCommand parent() {
		return parent;
	}

	public void add(RenderCommand e) {
		children.add(e);
	}

	protected void contributeChildren(Map<String, Object> model, Map<String, Filter> filters, StringBuffer buffer){
		for(RenderCommand child: children) child.contribute(model, filters, buffer);
	} 
	
}
